import React from 'react';
import { connect, history } from 'umi';
import SceneForm from './SceneForm';
import { Button, Tooltip } from 'antd';
import { InfoCircleFilled } from '@ant-design/icons';
import styles from './index.less';

@connect(({ SensitivityAnalysis }) => ({
  SensitivityAnalysis,
}))
export default class extends React.Component {
  forms = {};
  componentDidMount = () => {};

  getSceneSimulatorData = async () => {
    const { sceneForm } = this.forms;
    var attr = [sceneForm?.validateFields()];
    var [sceneFormData] = await Promise.all(attr);
    console.log(sceneFormData, 'sceneFormData');
  };
  render() {
    return (
      <div className={styles.SceneSimulator}>
        <div className={styles.title}>
          <div className={styles.text}>场景模拟器</div>
          <Tooltip title="请先设置模拟场景">
            <span className={styles.infoIcon}>
              <InfoCircleFilled />
            </span>
          </Tooltip>
        </div>
        <SceneForm init={form => (this.forms.sceneForm = form)} />
        <Button
          type="primary"
          style={{ width: '100%', marginTop: 8 }}
          onClick={() => {
            this.getSceneSimulatorData();
          }}
        >
          预载历史数据
        </Button>
      </div>
    );
  }
}
